package top.blackr.folivora.common.log.interceptor;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.filter.CommonsRequestLoggingFilter;

@Configuration
public class SpringLogConfig {

    /**
     * 请求日志过滤器
     *
     * @return CommonsRequestLoggingFilter
     */
    @Bean
    public CommonsRequestLoggingFilter logFilter() {
        LogCommonsRequestLoggingFilter loggingFilter = new LogCommonsRequestLoggingFilter();
        loggingFilter.setIncludeQueryString(true);
        loggingFilter.setIncludePayload(true);
        loggingFilter.setIncludeClientInfo(true);
        loggingFilter.setAfterMessagePrefix("");
        loggingFilter.setMaxPayloadLength(1024 * 256);
        loggingFilter.setIncludeClientInfo(false);
        return loggingFilter;
    }
}
